package cn.jiangjiesheng.bootstrap.filestore.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * Created by dev@jiangjiesheng.cn on 2021/7/9  <br/>
 */
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "filestore")
@Data
public class FileStoreProperties implements Serializable {

    private boolean enabled = false;

    /**
     * 上传目标
     * 支持minio/oss/obs
     */
    @NotNull
    private StoreBackendEnum storeBackend;

    @NotNull
    private String endpoint;

    @NotNull
    private String ak;

    @NotNull
    private String sk;

    @NotNull
    private String defaultBucket;

    /**
     * for oss;可空，生成临时访问授权时必须
     * https://help.aliyun.com/document_detail/32016.html?spm=a2c4g.11186623.6.996.459343503pPzoB
     */
    private String securityToken;

}
